<?

  class ServicesController extends CFD_Controller_Action
  {
    public function vrmLookupAction()
	{
	  if ($_GET['vrm'])
	  {
	    $vehObj = new CFD_CAP_Vehicles();
	    $this->view->vehicle = $vehObj->DVLALookupVRM($_GET['vrm']);
	  }
	}

    public function carModelsAction()
	{
	  $vehObj = new CFD_CAP_Vehicles();
	  $this->view->brands = $vehObj->GetCAPMan();

	  foreach ($this->view->brands as $brand)
	    $carModels[ $brand->id ] = $vehObj->GetCAPRange($brand, $_POST['update'] != 'Update' );

	  $this->view->carModels = $carModels;

	  if ($_POST['update'] == 'Update')
	    Alert_View::addMessage(Alert_View::NOTICE, "", "Data succesfully updated.");
	}

    public function carBrandsAction()
	{
	  $vehObj = new CFD_CAP_Vehicles();
	  $this->view->brands = $vehObj->GetCAPMan( $_POST['update'] != 'Update' );

	  if ($_POST['update'] == 'Update')
	    Alert_View::addMessage(Alert_View::NOTICE, "", "Data succesfully updated.");
	}
  }
